<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="http://at.alicdn.com/t/c/font_2592779_u9zya6masq.css">
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        ul {
            list-style: none;
        }

        .outer {
            --size: 100vw;
            overflow: hidden;
            width: var(--size);
            position: relative;
        }

        .b-list {
            width: calc(5 * var(--size));
            transition: all .5s;
            display: flex;
        }

        .b-list li {
            width: var(--size);
            height: 100vh;
        }

        img {
            width: 100%;
            object-fit: cover;
        }

        .l-list {
            box-sizing: border-box;
            display: flex;
            width: 100%;
            height: 0;
            position: absolute;
            bottom: 30vh;
            padding: 0 calc(var(--size) / 10);
            justify-content: space-between;
        }

        .l-list li {
            width: calc(var(--size) / 10);
            cursor: pointer;
        }

        .l-list img {
            box-shadow: 0 0 4px 2px #0d0;
        }

        .l-list .current img {
            box-shadow: 0 0 4px 2px #e60b0b;
        }

        .arrows {
            height: 0;
            width: 100%;
            position: absolute;
            top: 50%;
        }

        .left,
        .right {
            position: absolute;
            top: calc(var(--size) / 100 * -3);
            height: calc(var(--size) / 100 * 6);
            cursor: pointer;
        }

        .iconfont {
            font-size: calc(var(--size) / 100 * 6);
            color: #fff;
            opacity: .5;
        }

        .iconfont:hover {
            opacity: 1;
        }

        .right {
            right: 0;
        }
    </style>
</head>

<body>
    <div class="outer">
        <ul class="b-list">
            <li><a href="#"><img src="./images/pvp/0.jpg" alt=""></a></li>
            <li><a href="#"><img src="./images/pvp/1.jpg" alt=""></a></li>
            <li><a href="#"><img src="./images/pvp/2.jpg" alt=""></a></li>
            <li><a href="#"><img src="./images/pvp/3.jpg" alt=""></a></li>
            <li><a href="#"><img src="./images/pvp/4.jpg" alt=""></a></li>
        </ul>
        <ul class="l-list">
            <li class="current"><img src="./images/pvp/0.jpg" alt=""></li>
            <li><img src="./images/pvp/1.jpg" alt=""></li>
            <li><img src="./images/pvp/2.jpg" alt=""></li>
            <li><img src="./images/pvp/3.jpg" alt=""></li>
            <li><img src="./images/pvp/4.jpg" alt=""></li>
        </ul>
        <div class="arrows">
            <div class="left">
                <i class="iconfont icon-zuojiantou"></i>
            </div>
            <div class="right">
                <i class="iconfont icon-youjiantou"></i>
            </div>
        </div>
    </div>
    <script>
        var blist = document.querySelector('.b-list')
        var leftArrow = document.querySelector('.left')
        var rightArrow = document.querySelector('.right')
        var sms = document.querySelectorAll('.l-list li')

        var current = 0;
        var size = document.querySelector('.outer').offsetWidth;

        leftArrow.onclick = moveLeft;
        function moveLeft() {
            sms[current].classList.remove('current')
            current--;
            if (current < 0) {
                current = sms.length - 1;
            }
            effect();
        }

        rightArrow.onclick = moveRight
        function moveRight() {
            sms[current].classList.remove('current')
            current++;
            if (current >= sms.length) {
                current = 0;
            }
            effect();
        }

        function effect(dir = 'left') {
            var target = size * current * -1;
            blist.style.transform = `translateX(${target}px)`;
            sms[current].classList.add('current')
        }

        sms.forEach((item, index) => {
            item.onclick = function () {
                sms[current].classList.remove('current')
                current = index;
                effect();
            }
        })

        let timer = setInterval(moveRight, 2500);
        blist.onmouseenter = function () {
            clearInterval(timer)
        }
        blist.onmouseleave = function () {
            timer = setInterval(moveRight, 2500);
        }
    </script>
</body>

</html>